<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>按钮</button>
    <div>0</div>
</body>
<script>
    let btn = document.getElementsByTagName('button')[0];
    let div = document.getElementsByTagName('div')[0];
    let key = div.innerHTML;
    let res = parseInt(key);
    btn.onclick = function() {
        key++;
        div.innerHTML = key
    }
</script>

</html>